Skip to content

[Rust] Make Rust crate version configurable. #996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

gierlachg
Copy link
Contributor

@gierlachg gierlachg commented May 22, 2024

Not sure if this is something you would be willing to accept.

@gierlachg gierlachg force-pushed the rust-semver branch 3 times, most recently from 5da018e to 7b3f38f Compare May 22, 2024 12:01
@@ -117,7 +117,7 @@ public void generate() throws IOException

indent(writer, 0, "[package]\n");
indent(writer, 0, "name = \"%s\"\n", namespace);
indent(writer, 0, "version = \"0.1.0\"\n");
indent(writer, 0, "version = \"%s\"\n", ir.semanticVersion());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be great, I +1 this.

Even better would be if we put this in codegen too, so you could start checking for semver against clients?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe using a semanticVersion is optional and ir.semanticVersion() might be null.

@ZachBray
Copy link
Contributor

ZachBray commented Aug 21, 2024

Thank you for your contribution.

It is common for SBE schemas to use a FIX version name or $major.$minor, e.g., in Aeron Archive's SBE schema, as the messageSchema#semanticVersion. The SBE specification doesn't specify any particular format for the semanticVersion attribute value. Therefore, it would be best not to expect a particular format in the code generator.

From all the file changes, I assume you need to output in x.y.z format?

Please can you make the code generator more lenient and reduce the number of changes across existing schema files?

You could consider using a system property to specify the crate version instead of using the semanticVersion attribute value. I suspect there are cases where the crate version may change, e.g., when you upgrade the SBE code generator, but the schema does not.

@gierlachg
Copy link
Contributor Author

From all the file changes, I assume you need to output in x.y.z format?

Exactly.

Please can you make the code generator more lenient and reduce the number of changes across existing schema files?

Done.

You could consider using a system property to specify the crate version instead of using the semanticVersion attribute value. I suspect there are cases where the crate version may change, e.g., when you upgrade the SBE code generator, but the schema does not.

Makes sense. What about this?

@gierlachg gierlachg changed the title [Rust] Use schema semantic version to populate Rust crate version. [Rust] Make Rust crate version configurable. Aug 21, 2024
@ZachBray ZachBray merged commit 80308ae into aeron-io:master Aug 22, 2024
34 checks passed
@gierlachg gierlachg deleted the rust-semver branch August 24, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants